www.gusucode.com > Toyota Human Support Robot (HSR) Examples 程序工具箱matlab源码 > Toyota Human Support Robot (HSR) Examples/MATLAB_HSR_Examples/03_gripperControl/gripperControl_topic.m
% Example: Control the grippers using ROS topic % initialize ROS publisher pub = rospublisher('/hsrb/gripper_controller/command'); % fill ROS message traj = rosmessage(pub); traj.JointNames = {'hand_motor_joint'}; p1 = rosmessage('trajectory_msgs/JointTrajectoryPoint'); p1.Positions = [0.5]; p1.Velocities = [0]; p1.Effort = [0.1]; p1.TimeFromStart = rosduration(3); traj.Points = [p1]; % publish ROS message send(pub,traj); % Copyright 2018 The MathWorks, Inc.